﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Csla.Xaml;
using HeThongThongTin.Library;
using System.Windows.Data;
using BusinessConfiguration;

namespace HeThongThongTin.UI.SL.HeThong.HT_QuanLyVaiTroQuyenHan
{
    public class HT_QuyenHan_ListViewModel : ViewModel<HT_QuyenHanList>
    {
        public event EventHandler LoadCompleted;
        public HT_QuyenHan_ListViewModel(string mode)
        {
            BeginRefresh("GetHT_QuyenHanList", mode);
          
        }
        public HT_QuyenHan_ListViewModel(int KhoaBangDuLieu)
        {
            BeginRefresh("GetHT_QuyenHanList", KhoaBangDuLieu);

        }
        protected override void OnRefreshed()
        {
            base.OnRefreshed();
            if (Model != null)
            {
                if (LoadCompleted != null)
                {
                    LoadCompleted(this, new EventArgs());
                }
            }
        }

        public void GetHT_QuyenHan_ListViewModel(string mode)
        {
            BeginRefresh("GetHT_QuyenHanList", mode);
        }

        public void GetHT_QuyenHan_ListViewModel(int BangDuLieuId)
        {
            BeginRefresh("GetHT_QuyenHanList", BangDuLieuId);
        }

        public static readonly DependencyProperty SelectedItemProperty =
          DependencyProperty.Register("SelectedItem", typeof(HT_QuyenHanInfo), typeof(HT_QuyenHan_ListViewModel), null);
        public HT_QuyenHanInfo SelectedItem
        {
            get { return (HT_QuyenHanInfo)GetValue(SelectedItemProperty); }
            set { SetValue(SelectedItemProperty, value); }
        }

        public void DeleteHT_QuyenHan(object sender, ExecuteEventArgs e)
        {
            //if (e.MethodParameter != null)
            //{
                //cast parameter
                //string parameter = e.MethodParameter.ToString();
                //this.IsBusy = true;
               // HeThongThongTin.Library.HT_QuyenHan.DeleteHT_QuyenHan(int.Parse(parameter), (o, ex) =>
                //{
                   // BeginRefresh("GetHT_QuyenHanList", BusinessConfiguration.Configuration.GridViewFetchMode);
                //});
                //this.IsBusy = false;
            //}
        }
    }
}

 
			
        
 
				
        	